import express from "express";
import path from "path";
import { fileURLToPath } from "url";

const app = express();
const port = process.env.PORT || 3000;

app.get("/", (req, res) => {
    res.type("text/html");
    res.send("<h1>HomePage</h1>");
});

app.use((req, res) => {
    res.type("text/plain");
    res.status(404);
    res.send("404 - Not Found");
});

app.use((err, req, res, next) => {
    console.log(`${err.message}`);
    res.type("text/plain");
    res.staus(500);
    res.send("500 - Server Error");
});

app.listen(port, () => console.log(`Go visiting http://localhost:${port} , Press Ctrl - C to stop the server`));
